﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;

namespace PeisongWeb.admin
{
    public partial class userInfoEdit : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                getDetails();
            }
        }
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            SysAdminEntity adminEnt = new SysAdminEntity();
            adminEnt.Username = txt_username.Text;
            adminEnt.Realname = txt_realname.Text;
            adminEnt.Email = txt_email.Text;
            adminEnt.Mobile = txt_mobile.Text;
            adminEnt.AdminId = logic.sysAdmin.AdminID;
            adminEnt.Password = hid_pwd.Value;
            logic.sysAdmin.update(adminEnt);
            Library.Script.ClientMsg("修改成功！");
        }
        private void getDetails()
        {
            SysAdminEntity adminEnt = logic.sysAdmin.getById(logic.sysAdmin.AdminID);
            hid_pwd.Value = adminEnt.Password;
            txt_username.Text = adminEnt.Username;
            txt_username.Enabled = false;
            txt_realname.Text = adminEnt.Realname;
            txt_email.Text = adminEnt.Email;
            txt_mobile.Text = adminEnt.Mobile;
        }
    }
}
